{% extends 'admin-v2/layout.html.twig' %}

{% set script_controller = 'question-bank/list' %}

{% set menu = 'admin_v2_question_bank_basic' %}

{% block main %}
  <form id="message-search-form" class="form-inline well well-sm" action="{{ path('admin_v2_question_bank') }}" method="get" novalidate>
    <div class="form-group">
      {% include 'org/org-tree-select.html.twig' with {orgCode: app.request.get('orgCode'), modal: 'list'} %}
    </div>
    <div class="form-group">
      <select style="width:150px;" class="form-control" name="categoryId">
        <option value="">{{'admin.question_bank.manage.category'|trans}}</option>
        <option value="">{{'admin.question_bank.manage.all_category'|trans}}</option>
        {{ select_options(build_category_choices(categoryTree), categoryId) }}
      </select>
    </div>
    <div class="form-group">
      <input class="form-control" type="text" placeholder="{{'admin.question_bank.manage.enter_bank_name.placeholer'|trans}}" name="nameLike" value="{{app.request.get('nameLike')}}">
    </div>
    <button class="btn btn-primary">{{ 'form.btn.search'|trans }}</button>
  </form>

  <table class="table table-hover table-striped" id="bank-table">
    <thead>
      <tr>
        <th width="25%">{{'admin.question_bank.manage.name'|trans}}</th>
        <th>{{'admin.question_bank.manage.bank_content'|trans}}</th>
        {% if setting('magic.enable_org', 0) %}
          <th>{{ 'site.org.belongs_to_org_th'|trans }}</th>
        {% endif %}
        <th>{{'admin.question_bank.manage.category'|trans}}</th>
        <th width="10%">{{'admin.question_bank.manage.operate'|trans}}</th>
      </tr>
    </thead>
    <tbody>
      {% if questionBanks %}
        {% for questionBank in questionBanks %}
          {% set category = categories[questionBank.categoryId]|default(null) %}
          {% include 'admin-v2/teach/question-bank/tr.html.twig' %}
        {% endfor %}
      {% else %}
        <tr><td colspan="20"><div class="empty">{{'admin.question_bank.manage.empty'|trans}}</div></td></tr>
      {% endif %}
    </tbody>
  </table>
  {{ admin_macro.paginator(paginator) }}
{% endblock %}